//
//  SceneViewController.m
//  PrivatePodspec
//
//  Created by YDY on 2024/12/13.
//

#import "SceneViewController.h"
#import "headerView.h"



@interface SceneViewController () <UITableViewDelegate,UITableViewDataSource>

@property (nonatomic,strong) UITableView *tableView;
@property (nonatomic,strong) headerView *headerView;



@end

@implementation SceneViewController

- (void)viewDidLoad {
    [super viewDidLoad];
    
    [self.view addSubview:self.tableView];
    [self.tableView mas_makeConstraints:^(MASConstraintMaker *make) {
       
        make.edges.equalTo(self.view).insets(UIEdgeInsetsMake(0, 0, 0, 0));
    }];
    
    [self performSelector:@selector(sss) withObject:@"" afterDelay:2];
    
    [self.tableView setTableHeaderView:self.headerView];
  

}

-(void)sss {
    
    headerModel *model = [[headerModel alloc]init];
    [model setTitle:@"美国2025财年国防授权法案再以\n美国2025财年国防授权法案再以\n美国2025财年国防授权法案再以\n美国2025财年国防授权法案再以"];
    [model setDesc:@"据美媒报道，美国国会众议院当"];
    
    [model setItemArray:@[@"SAPPHIRE-H_01011.95.01",@"SAPPHIRE-H_01011.95.01",@"SAPPHIRE-H_01011.95.01",@"SAPPHIRE-H_01011.95.01",@"SAPPHIRE-H_01011.95.01",@"SAPPHIRE-H_01011.95.01",@"SAPPHIRE-H_01011.95.01"]];
    
    __weak typeof(self) weakSelf = self;
    [self.headerView setModel:model block:^(CGFloat height) {
        
        [weakSelf.headerView setFrame:CGRectMake(0,0, weakSelf.view.frame.size.width, height)];
        [weakSelf.tableView setTableHeaderView:weakSelf.headerView];
        
    }];
}

- (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section {
    
    return 10;
    
}

-(CGFloat)tableView:(UITableView *)tableView heightForRowAtIndexPath:(NSIndexPath *)indexPath {
    
    return 60.0;
    
}

- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath {
    
    UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:@"UITableViewCell"];
    if (!cell) {
        cell = [[UITableViewCell alloc]initWithStyle:UITableViewCellStyleDefault reuseIdentifier:@"UITableViewCell"];
    }
    [cell.textLabel setText:@"1213131231"];
    return cell;
}


#pragma mark - lazy
-(UITableView *)tableView {
    if (!_tableView) {
        
        _tableView = [[UITableView alloc]initWithFrame:CGRectZero style:UITableViewStylePlain];
        [_tableView setDelegate:self];
        [_tableView setDataSource:self];
        [_tableView setBackgroundColor:UIColor.greenColor];
    }
    return _tableView;
}





- (headerView *)headerView {
    if (!_headerView) {
        
        _headerView = [[headerView alloc]initWithFrame:CGRectMake(0, 0, self.view.frame.size.width, 0)];
    }
    return _headerView;
}









@end
